﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace EcSalseManage.PageCommon
{
    public partial class DepartmentSearch : System.Web.UI.Page
    {
        wsKDHR.Service wsKDHRMS = new wsKDHR.Service();
        protected void Page_Load(object sender, EventArgs e)
        {
           
            Response.ContentType = "text/html";
            DataTable dtQuestions;
            dtQuestions = wsKDHRMS.getProjectDepartment().Tables[0];
            dtQuestions.DefaultView.RowFilter = "Name like '%" + Request.Form.Get("q").ToLower() + "'";


            System.Text.StringBuilder strJSArr = new System.Text.StringBuilder("arrOptions = new Array(");
            int iCount = 0;
            foreach (DataRow row in
dtQuestions.Rows)
            {
                if (iCount > 0)
                {
                    strJSArr.Append(",");
                }
                strJSArr.Append("[");
                strJSArr.Append("\"" +
                    row["Name"].ToString()
                    + "\",");
                strJSArr.Append("\"" +
                    row["ID"].ToString()
                    + "\"");
                strJSArr.Append("]");
                iCount++;
            }

            strJSArr.Append(");");
            Response.Write(strJSArr.ToString());
        }
    }
}
